FROM ubuntu:latest

MAINTAINER mayan50 <2575572904@qq.com>

ENV LANG=zh_CN.UTF-8
ENV LC_ALL=zh_CN.UTF-8
ENV LC_LANG=zh_CN.UTF-8



################## 安装openjdk ###################
## 不指定版本，使用最新openjdk8

RUN apt update && \
    apt -y install openjdk-17-jdk

################## 安装nginx #####################
RUN apt -y install nginx
    # forward request and error logs to docker log collector
RUN ln -sf /dev/stdout /var/log/nginx/access.log
RUN ln -sf /dev/stderr /var/log/nginx/error.log

COPY dist /apps/publish_helper/vue
COPY nginx.conf /etc/nginx/nginx.conf

################## 安装语言包 解决中文变问号问题 #####################
RUN apt -y install language-pack-zh-hans

################## 部署java项目 #####################

COPY ph-0.0.1-SNAPSHOT.jar /apps/publish_helper/ph-0.0.1-SNAPSHOT.jar
COPY config.json /apps/publish_helper/config/config.json
COPY start.sh /apps/publish_helper/start.sh

################## 安装cURL：解决容器验证码服务空指针错误，因为alpine中缺少FontConfiguration，需要安装ttf-dejavu这个软件 #####################
#RUN set -xe \
#    && apk --no-cache add ttf-dejavu fontconfig

# 修复Error loading shared library libstdc++.so.6: No such file or directory (needed by /root/.cache/JNA/temp/jna10715286436623332333.tmp)
# RUN #apk add libc6-compat && apk add libstdc++

# RUN nginx -c /etc/nginx/nginx.conf

# 开放外部访问端口
EXPOSE 80

CMD [ "sh","/apps/publish_helper/start.sh" ]
